package com.blrs.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.blrs.system.domain.SysUploadFile;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.blrs.common.annotation.Log;
import com.blrs.common.core.controller.BaseController;
import com.blrs.common.core.domain.AjaxResult;
import com.blrs.common.enums.BusinessType;
import com.blrs.domain.ProjectConfirmationEvaluation;
import com.blrs.service.project.evaluation.IProjectConfirmationEvaluationService;
import com.blrs.common.utils.poi.ExcelUtil;
import com.blrs.common.core.page.TableDataInfo;

/**
 * 项目确认及评价Controller
 * 
 * @author wangchao
 * @date 2023-12-11
 */
@RestController
@RequestMapping("/project/evaluation")
public class ProjectConfirmationEvaluationController extends BaseController
{
    @Autowired
    private IProjectConfirmationEvaluationService projectConfirmationEvaluationService;

    @PostMapping("/addEvaluateWK")
    public AjaxResult addEvaluateWK(@RequestBody SysUploadFile sysUploadFile)
    {
        return toAjax(projectConfirmationEvaluationService.evaluateWK(sysUploadFile));
    }
    /**
     * 查询项目确认及评价列表
     */
    @GetMapping("/list")
    public TableDataInfo list(ProjectConfirmationEvaluation projectConfirmationEvaluation)
    {
        startPage();
        List<ProjectConfirmationEvaluation> list = projectConfirmationEvaluationService.selectProjectConfirmationEvaluationList(projectConfirmationEvaluation);
        return getDataTable(list);
    }

    /**
     * 导出项目确认及评价列表
     */
    @Log(title = "项目确认及评价", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProjectConfirmationEvaluation projectConfirmationEvaluation)
    {
        List<ProjectConfirmationEvaluation> list = projectConfirmationEvaluationService.selectProjectConfirmationEvaluationList(projectConfirmationEvaluation);
        ExcelUtil<ProjectConfirmationEvaluation> util = new ExcelUtil<ProjectConfirmationEvaluation>(ProjectConfirmationEvaluation.class);
        util.exportExcel(response, list, "项目确认及评价数据");
    }

    /**
     * 获取项目确认及评价详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(projectConfirmationEvaluationService.selectProjectConfirmationEvaluationById(id));
    }

    /**
     * 新增项目确认及评价
     */
    @Log(title = "项目确认及评价", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProjectConfirmationEvaluation projectConfirmationEvaluation)
    {
        return toAjax(projectConfirmationEvaluationService.insertProjectConfirmationEvaluation(projectConfirmationEvaluation));
    }

    /**
     * 修改项目确认及评价
     */
    @Log(title = "项目确认及评价", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProjectConfirmationEvaluation projectConfirmationEvaluation)
    {
        return toAjax(projectConfirmationEvaluationService.updateProjectConfirmationEvaluation(projectConfirmationEvaluation));
    }

    /**
     * 删除项目确认及评价
     */
    @Log(title = "项目确认及评价", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(projectConfirmationEvaluationService.deleteProjectConfirmationEvaluationByIds(ids));
    }
}
